from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from merchant.apps.coupons.models import *

class CouponAdmin(admin.ModelAdmin):
	fieldsets = (
		(None, {'fields': ('business',('title','slug'),('subtitle','dollar_value'),'details','image','merchant_offer_code',)}),
		(_(u'Run dates'), {'fields': ('start_date','expiry_date',)}),
		(_(u'Misc'), {'fields': ('coupon_url','featured', 'categories',)}),
	)	
	list_display = ('coupon_code','business','title','start_date','expiry_date','featured',)
	list_filter = ('featured',)
	search_fields = ('title','subtitle','details',)
	prepopulated_fields = {'slug': ('title','subtitle',)}
	raw_id_fields = ('business',)
	filter_vertical = ('categories',)


class OrganizerAdmin(admin.ModelAdmin):
	fieldsets = (
		(None, {'fields': ('user','coupons',)}),
	)	
	list_display = ('user','created','total_organizer_value',)
	list_filter = ('created',)
	search_fields = ('user',)
	raw_id_fields = ('user',)
	filter_vertical = ('coupons',)

admin.site.register(Coupon, CouponAdmin)
admin.site.register(Organizer, OrganizerAdmin)